package org.thirdHero.admin.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.thirdHero.admin.annotation.LoginAdmin;
import org.thirdHero.db.domain.SysUser;
import org.thirdHero.db.service.LitemallUserService;
import org.thirdHero.core.util.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/admin/dashboard")
public class DashbordController {
    private final Log logger = LogFactory.getLog(DashbordController.class);

    @Resource
    private LitemallUserService userService;

    @GetMapping("")
    public Object info(@LoginAdmin SysUser sysUser){

        int userTotal = userService.count();
        Map<String, Integer> data = new HashMap<>();
        data.put("userTotal", userTotal);
        data.put("goodsTotal", 0);
        data.put("productTotal", 0);
        data.put("orderTotal", 0);

        return ResponseUtil.ok(data);
    }

}
